package service;

public class Profit {

	public int slave;
	public int oldmaster;
	public int tax;
	public int origin;
	

	/**
	 * 
	 * @param price 当前价
	 * @param oldmaster 是否有原始主人
	 * @return
	 */
	public static Profit count(int price,boolean oldmaster){
		Profit p = new Profit();
		p.origin = (int)(price / 1.1);
		//p.slave = (int)(p.origin * 0.05);
		if(oldmaster){
			p.oldmaster = (int)(p.origin * 0.05);
		}else{
			p.oldmaster = 0;
		}
		p.tax = 10;
		p.slave = price - p.origin - p.tax - p.oldmaster;
		
		return p;
		
	}

	public int getSlave() {
		return slave;
	}

	public void setSlave(int slave) {
		this.slave = slave;
	}

	public int getOldmaster() {
		return oldmaster;
	}

	public void setOldmaster(int oldmaster) {
		this.oldmaster = oldmaster;
	}

	public int getTax() {
		return tax;
	}

	public void setTax(int tax) {
		this.tax = tax;
	}

	public int getOrigin() {
		return origin;
	}

	public void setOrigin(int origin) {
		this.origin = origin;
	}
}
